Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MESOS: check for errors during resource allocation in the scheduler plugin #15976

Conversation

s-urbaniak
Copy link
Contributor

@k8s-bot
Copy link

k8s-bot commented Oct 20, 2015

Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist")

If this message is too spammy, please complain to ixdy.

@s-urbaniak
Copy link
Contributor Author

@jdef PTAL

I tracked my changes with single atomic commits. Also please let me know if you have an idea on how to bump up code coverage with some test scenario of doSchedule.

@@ -341,7 +348,9 @@ func (k *kubeScheduler) doSchedule(task *podtask.T, err error) (string, error) {
}

task.Offer = offer
k.api.algorithm().Procurement()(task, details) // TODO(jdef) why is nothing checking the error returned here?
if err := k.api.algorithm().Procurement()(task, details); err != nil {
return "", err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot to mention earlier, we probably want to offer.Release() before returning

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and task.Reset()

@k8s-github-robot
Copy link

Labelling this PR as size/M

@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 20, 2015
@s-urbaniak
Copy link
Contributor Author

@jdef PTAL added offer.Release() and task.Reset() and rebased :-)

@k8s-bot
Copy link

k8s-bot commented Oct 21, 2015

Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist")

If this message is too spammy, please complain to ixdy.

2 similar comments
@k8s-bot
Copy link

k8s-bot commented Oct 26, 2015

Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist")

If this message is too spammy, please complain to ixdy.

@k8s-bot
Copy link

k8s-bot commented Oct 26, 2015

Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist")

If this message is too spammy, please complain to ixdy.

@@ -278,7 +278,11 @@ func (k *kubeScheduler) Schedule(pod *api.Pod, unused algorithm.NodeLister) (str
log.Infof("aborting Schedule, pod has been deleted %+v", pod)
return "", noSuchPodErr
}
return k.doSchedule(k.api.tasks().Register(k.api.createPodTask(ctx, pod)))
task, err := k.api.tasks().Register(k.api.createPodTask(ctx, pod))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also Register has this strange type with an error as second argument. Can we fix this as well here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 will do, indeed a strange pattern

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 6a16fe3

@karlkfi karlkfi assigned karlkfi and unassigned karlkfi Nov 10, 2015
@karlkfi
Copy link
Contributor

karlkfi commented Nov 10, 2015

ping me when you need a review on this.

Sergiusz Urbaniak added 7 commits November 10, 2015 14:12
doSchedule currently accepts err values from previous invocation delegating
error handling in a location different from the caller which can be hard
to debug and is not a good practice.

We still maintain the same invariants after the refactoring. If an err
happened in a previous invocation to Register, the returned task object
was nil causing task.AcceptedOffer() to return false.

By not invoking doSchedule in case of an error we can eliminate the
first `err == nil` check in doScheduler.
The variable `offer` is shadowed in the if block causing the `then`
branch to be non-effective.
@k8s-github-robot
Copy link

Labelling this PR as size/L

@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 10, 2015
@s-urbaniak
Copy link
Contributor Author

@karlkfi @sttts PTAL

@sttts
Copy link
Contributor

sttts commented Nov 10, 2015

lgtm

@k8s-bot
Copy link

k8s-bot commented Nov 10, 2015

GCE e2e test build/test passed for commit 6a16fe3.

@s-urbaniak
Copy link
Contributor Author

@jdef PTAL

@k8s-bot
Copy link

k8s-bot commented Nov 10, 2015

GCE e2e test build/test passed for commit 9b7e405.

@jdef
Copy link
Contributor

jdef commented Nov 11, 2015

lgtm

@jdef jdef added lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-merge labels Nov 11, 2015
@k8s-github-robot
Copy link

Continuous integration appears to have missed, closing and re-opening to trigger it

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Nov 11, 2015

GCE e2e test build/test passed for commit 9b7e405.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

k8s-github-robot pushed a commit that referenced this pull request Nov 11, 2015
@k8s-github-robot k8s-github-robot merged commit 8d923af into kubernetes:master Nov 11, 2015
sttts added a commit to mesosphere-backup/kubernetes that referenced this pull request Nov 12, 2015
…475-error-checking"

The given merge will be rebased manually and appended to the scheduler refactoring.

This reverts commit 8d923af, reversing
changes made to d7458dd.
sttts pushed a commit to mesosphere-backup/kubernetes that referenced this pull request Nov 12, 2015
…r-checking

Rebased previously reverted merge, just before this scheduler refactoring.

Auto commit by PR queue bot
RichieEscarez pushed a commit to RichieEscarez/kubernetes that referenced this pull request Dec 4, 2015
…475-error-checking"

The given merge will be rebased manually and appended to the scheduler refactoring.

This reverts commit 8d923af, reversing
changes made to d7458dd.
RichieEscarez pushed a commit to RichieEscarez/kubernetes that referenced this pull request Dec 4, 2015
…r-checking

Rebased previously reverted merge, just before this scheduler refactoring.

Auto commit by PR queue bot
@s-urbaniak s-urbaniak deleted the sur-k8sm-475-error-checking branch December 9, 2015 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform/mesos kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants